package com.tfswue.lhj.controller;

//import com.tfswue.lhj.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller 注解用于定义一个控制器类，处理 HTTP 请求，原来写法是 @Controller + @ResponseBody，json（它是@Controller 的一个变体）数据返回
@RestController
public class HelloController {

    @Value("${email}")
    private String email;
    @Value("${my1.email}")
    private String my1Email;
    @Value("${my2.email}")
    private String my2Email;
    @Value("${city1[0]}")
    private String city1;
    @Value("${sxt[0].mobile}")
    private String moble;


//    @Autowired
//    private Config config;

    @RequestMapping("/hello")
    public String hello() {
        return "配置好热加载功能后，修改配置文件会自动生效！当前时间：" + java.time.LocalDateTime.now();

    }

    @RequestMapping("/email")
    public String email() {
        return "Email: " + email;
    }

    @RequestMapping("/getvalue")
    public String getValue() {
        return email+";"+my1Email+";"+city1+";"+moble;

    }
    @GetMapping("/test")
    public String test() {
        return "测试接口正常工作！当前时间：" + java.time.LocalDateTime.now();
    }

}